#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QOpenGLWindow>
#include <QMouseEvent>
#include "../engine/GameEngine.h"

class GameWindow : public QOpenGLWindow
{
	Q_OBJECT;
public:
	GameWindow();
	GameWindow(GameEngine* engine);
	~GameWindow() {}
	GameEngine* getEngine() {
		return engine;
	}
protected:
	virtual void initializeGL();
	virtual void resizeGL(int w, int h);
	virtual void paintGL();
	void mousePressEvent(QMouseEvent* event) override {
		this->engine->getRender()->mousePressEvent(event);

	};
	void mouseReleaseEvent(QMouseEvent* event) {
		this->engine->getRender()->mouseReleaseEvent(event);
	}
	void mouseDoubleClickEvent(QMouseEvent* event) {
		this->engine->getRender()->mouseReleaseEvent(event);
	}
	void mouseMoveEvent(QMouseEvent* event) {
		this->engine->getRender()->mouseMoveEvent(event);
	}
	void keyPressEvent(QKeyEvent* event);
	void keyReleaseEvent(QKeyEvent* event);
private:
	GameEngine* engine;
	QElapsedTimer elapsedTimer;

};

#endif // !GAMEWINDOW_H

